package com.ay.shardingshere.mapper;

import com.ay.shardingshere.entity.OrderInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

/**
 * @Author: ay
 * @Date: 2021/6/29
 * @Description:
 **/
@Mapper
@Component
public interface OrderInfoMapper {

    /**
     * 保存订单信息
     * @param orderInfo
     */
    @Insert("insert into t_order_info(user_id,address_id,status,create_time) values(#{userId},#{addressId},#{status},#{createTime})")
    void save(OrderInfo orderInfo);


    /**
     * 更新订单信息
     * @param orderId
     */
    @Update("update t_order_info set user_id = 1001 where order_id = #{orderId}")
    void update(Long orderId);




    /**
     * 更新订单信息
     * @param addrId
     */
    @Update("update t_order_info set user_id = 1001 where address_id = #{addrId}")
    void updateByAddrId(Long addrId);
}
